<script type="text/javascript" src="/admin/assets/libs/layui/layui.js"></script>
<script type="text/javascript" src="/admin/assets/js/common.js"></script>
<script>
    SystemUtil.BaseURL = "{{admin_url('/')}}";
    SystemUtil.lang ={!! json_encode(__('admin_ui')) !!};
    SystemUtil.editor = function (id, config, formId) {
        tinymce.init(layui.$.extend({}, {
            selector: '#' + id,
            height: 525,
            branding: false,
            language: 'zh_CN',
            plugins: 'code print preview fullscreen paste searchreplace save autosave link autolink image imagetools media table codesample lists advlist hr charmap emoticons anchor directionality pagebreak quickbars nonbreaking visualblocks visualchars wordcount',
            toolbar: 'fullscreen preview code | undo redo | forecolor backcolor | bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | outdent indent | numlist bullist | formatselect fontselect fontsizeselect | link image media emoticons charmap anchor pagebreak codesample | ltr rtl',
            toolbar_drawer: 'sliding',
            images_upload_url: '../../../json/tinymce-upload-ok.json',
            file_picker_types: 'media'
        }, config || {}));
        if (SystemUtil.tinymceEle[formId]) {
            SystemUtil.tinymceEle[formId].push(id);
        } else {
            SystemUtil.tinymceEle[formId] = [id];
        }
    }

    function setLang(lang) {
        var name = 'lang';
        var Days = 30;
        var exp = new Date();
        exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000);
        document.cookie = name + "=" + escape(lang) + ";expires=" + exp.toGMTString() + ";path=/";
    }

    // layui.use(["element", "form"], function () {
    //     layui.layer.config({
    //         btn: [SystemUtil.lang.ok, SystemUtil.lang.cancel]
    //     });
    // })

</script>
